//
//  KWallNewForDynamicsCell.m
//  Keping
//
//  Created by apple on 2017/12/11.
//  Copyright © 2017年 柯平. All rights reserved.
//

#import "KWallNewForDynamicsCell.h"
#import <YYKit/UIImage+YYAdd.h>

@interface KWallNewForDynamicsCell()

@property (nonatomic, weak) IBOutlet UILabel *countLbl;
@property (nonatomic, weak) IBOutlet UIImageView *userImg;

@end

@implementation KWallNewForDynamicsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setWallNews:(NSArray *)wallNews {
    _wallNews = wallNews;
    
    self.countLbl.text = [NSString stringWithFormat:@"%lu New Notifications",(unsigned long)wallNews.count];
    KStatusLayout *statusLayout = wallNews.lastObject;
    WEAKSELF
    if (statusLayout) {
        [self.userImg sd_setImageWithURL:[NSURL URLWithString:[KGetImageURL stringByAppendingString:statusLayout.status.profile]] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
            if (!error) {
                image = [image imageByResizeToSize:CGSizeMake(weakSelf.userImg.width, weakSelf.userImg.height)];
            } else {
                image = [UIImage imageNamed:@"user.png"];
            }
        }];
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
